package xin.cms.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import xin.core.jpa.JpaConstant;
import xin.core.jpa.model.AutoDateUUIDEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import java.util.List;

/**
 * <pre>
 * 标签-用于给文章、新闻、通知等内容进行分类，发布和搜索时使用
 * </pre>
 *
 * @author lixin_ma@outlook.com
 * @version 1.0
 * @since 2018/8/8
 */

@Entity
@Table(name = "cms_tag")
@Data
@EqualsAndHashCode(callSuper = true)
public class Tag extends AutoDateUUIDEntity {

    /**
     * 标签名称
     */
    @Column(length = JpaConstant.CommonStringMidLength)
    private String name;

    /**
     * 文章映射
     */
    @JsonIgnore
    @ManyToMany(mappedBy = "tagList")
    private List<Article> articles;

}
